/* 编辑器页面样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f5f6fa;
  color: #333;
  line-height: 1.5;
  overflow: hidden;
}

.editor-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: white;
}

/* 头部样式 */
.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 12px 20px;
  border-bottom: 1px solid #e9ecef;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo svg {
  fill: white;
}

.editor-header h1 {
  font-size: 18px;
  font-weight: 600;
}

.header-right {
  display: flex;
  gap: 8px;
}

.header-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
}

.header-btn.secondary {
  background: rgba(0, 0, 0, 0.1);
  border-color: rgba(0, 0, 0, 0.2);
}

.header-btn.secondary:hover {
  background: rgba(0, 0, 0, 0.2);
}

.header-btn svg {
  fill: currentColor;
}

/* 工具栏样式 */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 12px 20px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
  flex-wrap: wrap;
}

.toolbar-section {
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-section label {
  font-size: 12px;
  color: #666;
  font-weight: 500;
  margin-right: 4px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}

.toolbar-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.toolbar-btn svg {
  fill: currentColor;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #333;
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-left: 20px;
}

.checkbox-label input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  cursor: pointer;
  height: 0;
  width: 0;
}

.checkbox-label .checkmark {
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  height: 14px;
  width: 14px;
  background-color: white;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  transition: all 0.2s ease;
}

.checkbox-label:hover input ~ .checkmark {
  background-color: #e9ecef;
}

.checkbox-label input:checked ~ .checkmark {
  background-color: #667eea;
  border-color: #667eea;
}

.checkbox-label .checkmark:after {
  content: "";
  position: absolute;
  display: none;
  left: 4px;
  top: 1px;
  width: 3px;
  height: 6px;
  border: solid white;
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}

.checkbox-label input:checked ~ .checkmark:after {
  display: block;
}

/* 主要内容区域 */
.editor-content {
  display: flex;
  flex: 1;
  min-height: 0;
}

.editor-panel,
.preview-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.editor-panel {
  border-right: 1px solid #e9ecef;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #f8f9fa;
  border-bottom: 1px solid #e9ecef;
}

.panel-header h3 {
  font-size: 14px;
  font-weight: 600;
  color: #333;
}

.panel-actions {
  display: flex;
  gap: 6px;
}

.action-btn {
  padding: 4px 8px;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 3px;
  font-size: 11px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
}

.action-btn:hover {
  background: #e9ecef;
}

.editor-area,
.preview-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

#html-editor {
  flex: 1;
  border: none;
  outline: none;
  padding: 16px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 13px;
  line-height: 1.6;
  background: #fafafa;
  color: #333;
  resize: none;
  tab-size: 2;
}

#html-editor:focus {
  background: white;
}

#preview-frame {
  flex: 1;
  border: none;
  background: white;
  width: 100%;
  height: 100%;
}

/* 底部状态栏 */
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.status-info {
  display: flex;
  gap: 16px;
}

.status-info span {
  font-size: 12px;
  color: #666;
}

.footer-right {
  display: flex;
  gap: 8px;
}

.footer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.footer-btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.footer-btn.primary:hover {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

.footer-btn.secondary {
  background: #e9ecef;
  color: #333;
  border: 1px solid #dee2e6;
}

.footer-btn.secondary:hover {
  background: #dee2e6;
}

.footer-btn svg {
  fill: currentColor;
}

/* 模态框样式 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal.show {
  display: flex;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: white;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  max-width: 800px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #e9ecef;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  color: #666;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.modal-close:hover {
  background: #f8f9fa;
  color: #333;
}

.modal-body {
  flex: 1;
  padding: 20px;
  overflow: auto;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 20px;
  border-top: 1px solid #e9ecef;
}

.modal-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn.primary {
  background: #667eea;
  color: white;
}

.modal-btn.primary:hover {
  background: #5a67d8;
}

.modal-btn.secondary {
  background: #e9ecef;
  color: #333;
}

.modal-btn.secondary:hover {
  background: #dee2e6;
}

/* 模板网格 */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.template-card {
  border: 1px solid #e9ecef;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.template-card:hover {
  border-color: #667eea;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.template-preview {
  height: 120px;
  background: #f8f9fa;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-bottom: 1px solid #e9ecef;
}

.template-info {
  padding: 12px;
}

.template-name {
  font-size: 14px;
  font-weight: 600;
  color: #333;
  margin-bottom: 4px;
}

.template-desc {
  font-size: 12px;
  color: #666;
}

/* SVG编辑器 */
.svg-editor-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  height: 300px;
}

.svg-input-section,
.svg-preview-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.svg-input-section label,
.svg-preview-section label {
  font-size: 12px;
  font-weight: 500;
  color: #333;
}

#svg-upload {
  padding: 8px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-size: 12px;
}

#svg-code {
  flex: 1;
  padding: 12px;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  resize: none;
}

#svg-preview {
  flex: 1;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 12px;
  background: white;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

#svg-preview svg {
  max-width: 100%;
  max-height: 100%;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .editor-content {
    flex-direction: column;
  }
  
  .editor-panel {
    border-right: none;
    border-bottom: 1px solid #e9ecef;
  }
  
  .editor-toolbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .svg-editor-container {
    grid-template-columns: 1fr;
    height: auto;
  }
  
  .template-grid {
    grid-template-columns: 1fr;
  }
  
  .footer-right {
    flex-direction: column;
  }
} 